home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagn_r.zip / PRINTING.SWG / 0040_Disable Print-Screen.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-03  |  2KB  |  46 lines

  1. {
  2. >If anyone could tell me how to disable [Print Screen] from within a
  3. >text-based program, I would appreciate it.  Thanks, - Jeff Napier, Another
  4. >Company -
  5.  
  6.  For that you can trap int 5h(Print Screen interrupt) Here is a program I
  7. wrote for someone on another network that will show you the basics of how
  8. it can be done:
  9.  
  10. nstn1410@fox.nstn.ca
  11. }
  12. PROGRAM DisableInt05h;          { Dec 13/93, Greg Estabrooks.           }
  13. USES CRT,                       { IMPORT Clrscr,KeyPressed.             }
  14.      DOS;                       { IMPORT SetIntVec,GetIntVec.           }
  15. VAR
  16.    OldInt05   :POINTER;         { Holds the old address of INT 05h.     }
  17.    NumPressed :WORD;            { The number of times PrtScr was pressed.}
  18.    Misc       :WORD;
  19.  
  20. {$F+}                           { Force FAR calls.                      }
  21. PROCEDURE NewInt05; ASSEMBLER;
  22. ASM
  23.   Push DS                       { Push DS onto stack.                   }
  24.   Mov AX,Seg @Data              { Now point DS to our data segment.     }
  25.   Mov DS,AX
  26.   Add NumPressed,1              { Add one to counter.                   }
  27.   Pop DS                        { Pop DS off stack.                     }
  28.   IRet                          { Force a return and pop flags off stack.}
  29. END;{NewInt05}
  30. {$F-}                           { Back to normal.                       }
  31.  
  32. BEGIN
  33.   NumPressed := 0;             { Clear number count.                    }
  34.   Clrscr;                      { Clear the screen.                      }
  35.   GetIntVec($05,OldInt05);     { Save Old Interrupt vector.             }
  36.   SetIntVec($05,@NewInt05);    { Point to our trap.                     }
  37.   Misc := 0;                   { Clear Counter.                         }
  38.   REPEAT                       { Loop Until a key other than PrtScr is  }
  39.                                { pressed.                               }
  40.     GOTOXY(1,1);               { Always show info at top corner.        }
  41.     Write(Misc:8,'...  You have pressed PrtScr ',NumPressed:3,' times.');
  42.     INC(Misc);                 { Increase counter to show a change.     }
  43.   UNTIL KeyPressed;
  44.   SetIntVec($05,OldInt05);     { Restore Old Interrupt vector.          }
  45. END.{DisableInt05h}
  46.